<?php

namespace App\Listeners;

use App\Events\Logined;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class addWeiHouThirdUser
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * @param Logined $event
     */
    public function handle(Logined $event)
    {
        $user = $event->user;
        if(!$user->weihou_id){
            $Webinar = \WeiHou::addRegisterThirdUser($user->mobile,111111);
            if($Webinar->getStatus()&&$Webinar->body['code'] == 200){
                $user->weihou_id = $Webinar->body['data']['user_id'];
                $user->save();
            }
        }
        //
    }
}
